package com.zhangxu.microservice.employee.api.feign;

import com.zhangxu.microservice.common.result.CommonResult;
import com.zhangxu.microservice.employee.api.response.EmployeeAuthDTO;
import com.zhangxu.microservice.employee.api.constant.SystemConstants;
import com.zhangxu.microservice.employee.api.response.EmployeeApiDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = SystemConstants.EMPLOYEE_SERVICE_NAME, contextId = "employeeClient")
public interface EmployeeClient {

    /**
     * 根据用户名查询用户信息（用于登录认证）
     *
     * @param account 用户名
     * @return 用户认证信息 DTO
     */
    @GetMapping(value = "/feign/auth/employee/search/account")
    CommonResult<EmployeeAuthDTO> getByAccount(@RequestParam("account") String account);

    /**
     * 根据员工ID单个查询
     *
     * @param employeeId 员工ID
     * @return 员工信息
     */
    @GetMapping(value = "/feign/employees/{employeeId}")
    CommonResult<EmployeeApiDTO> getById(@PathVariable("employeeId") Long employeeId);

    /**
     * 根据ID批量查询，单次最多100个
     *
     * @param employeeIds 员工ID
     * @return 员工信息
     */
    @GetMapping(value = "/feign/employees/listByIds")
    CommonResult<List<EmployeeApiDTO>> listByIds(@RequestParam("employeeIds") List<Long> employeeIds);

}
